<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Vue-extend</title>
    <link rel="stylesheet" href="../../../assets/css/bootstrap.min.css">
    <script src="../../../assets/js/vue-2.5.6.js"></script>
</head>

<body>
    <div id="app">
        <ul>
            <li v-for="(item,index) in items">{{item}}</li>
        </ul>
    </div>
    <button @click="add()">外部添加</button>
</body>
<script>
    function add() {
        console.log("我已经执行了");
        // app.items[1] = 'ddd';
        Vue.set(app.items, 1, 'ddd');
    }
    var outData = {
        items: ['aaa', 'bbb', 'ccc']
    };

    var app = new Vue({
        el: '#app',
        //引用外部数据
        data: outData
    });
</script>

</html>